<template>
	<view class="root">
		<!-- 提示信息弹窗 -->
		<uni-popup ref="groupFinish" >
			<view class="group-finish-content">
				<view class="g-title">
					还有未击杀的BOSS，若强行完成将不被正常计入完成次数，若真实情况已正常击杀，请上传图片作为材料提交。
				</view>
				<view class="uni-textarea">
					<textarea v-model="task_ok_desc" style="color: wheat;" placeholder-style="color:#a2a2a2" placeholder="适当说明情况"/>
				</view>
				<view class="example-body">
					<uni-file-picker limit="9" title="最多选择9张图片" @select="photoSelected" @delete="photoDelete"></uni-file-picker>
				</view>
				<view class="group-finis-b">
					<button type="primary" @click="groupSubmit()">提交</button>
				</view>
			</view>
		</uni-popup>
		<view class="video-bg">
			<video object-fit="cover" :controls="false" loop="loop" autoplay="autoplay" muted="muted" src="https://wow.v.netease.com/2025/0108/35599dab93866a2a0ed48409898776f5.mp4" poster="https://wow.v.netease.com/2025/0108/0c66abeefe14bffbf4d4384ada593274.jpg" class="video"></video>
		</view>
		<view class="cantiner">
			<view class="box">
				<view class="title-c">
					<view class="title" v-if="baseInfo != null">
						{{baseInfo.ins_info.name}}（<block v-if="baseInfo.ins_info.fb_type == 2">普通</block><block v-if="baseInfo.ins_info.fb_type == 3">英雄</block>{{' - 所需装等:' + baseInfo.ins_info.item_level}}）
					</view>
					
					<view class="submit-content">
						<view class="bott" style="margin-right: 15px;">
							<lf-select :v="TankNum" :range="tankRange" icon="/static/Tank_icon.png" @change="tankChange"/>
						</view>
						<view class="bott" style="margin-right: 15px;">
							<lf-select :v="HealerNum" :range="helthRange" icon="/static/Healer_icon.png" @change="helthChange"/>
						</view>
						<view class="bott" style="margin-right: 15px;">
							<lf-select :v="DPSNum" :range="dpsRange" icon="/static/DPS_icon.png" :disabled="true"/>
						</view>
						<view class="bott" @click="saveChanged">
							<btn-a w="100%" h="100%">保存修改</btn-a>
						</view>
					</view>
					
					<view style="margin-left: 30px; margin-right: 20px;" @click="removeGid">
						<btn-a w="100px" h="40px" :loading="doOverloading">摧毁队伍</btn-a>
					</view>
					<view @click="submitFinish">
						<btn-a w="100px" h="40px" :loading="doFinishLoading">提交完成</btn-a>
					</view>
				</view>
				<view class="boss-box">
					<block v-for="(b, index) in boss">
						<view class="boss">
							<boss-item :showGo="false" :bossIcon="b.bossInfo.icon_big" :killing="index == killingIndex" :killed="b.kill_status == 2" :selected="b.kill_status != 2" :name="b.bossInfo.boss_name"/>
						</view>
						<view class="next" v-if="index < boss.length - 1">
							<image src="/static/next.png" class="next-icon" mode=""></image>
						</view>
					</block>
				</view>
				
				<view class="find-box">
					<view class="find-b-left">
						<view class="gather" v-if="pids.length > 0">
							<view class="gather-lf">
								<lf-select :v="currentPid" :range="pids" @change="pidChanged"/>
							</view>
							<view class="gather-player">
								<block v-if="leaderManagerConnectStatus == 1">{{gatherPlayerName}}</block>
								<block v-else>
									<block v-if="pas">读取进程中...</block>
									<block v-else>
										<block v-if="leaderManagerConnectStatus == -2">{{gatherPlayerName}}</block>
										<block v-else>#-#</block>
									</block>
								</block>
							</view>
						</view>
						<view class="leader-manager-error" v-if="leaderManagerConnectStatus != 1">
							<leader-manager-error :error_status="leaderManagerConnectStatus" :error_title="leaderManagerErrorTitle"></leader-manager-error>
						</view>
						<block v-else>
							<view class="search-box">
								<view class="select-chr">
									<view class="s-title">
										获取玩家
									</view>
									<view class="sel">
										<lf-select :v="filter_s" :range="filterRange" :icon="filterRange[filter_s].icon" @change="filterChange"></lf-select>
									</view>
									<view class="search-b" v-for="(role, index) in filterRange[filter_s].sqec_list">
										<!-- <btn-a w="100%" h="100%" :enable="searchComplateChr == null && (blInvitePlayer != null && lmInvitePlayer != null)" @btnClick="findPlayer(index)"> -->
										<btn-a w="100%" h="100%" :enable="searchComplateChr == null" @btnClick="findPlayer(index)">
											<view class="search-title">
												<image :src="role.icon" mode="" class="role-icon"></image>
												<view>
													{{role.spec_name}}({{roleNeedCount[role.role + '_num'] - roleCount[role.role + '_count']}})
												</view>
											</view>
										</btn-a>
									</view>
								</view>
								<!-- this.blInvitePlayer == null || this.lmInvitePlayer == null -->
								<view class="search-complete-char">
									<!-- <view class="no-invite-player" v-if="blInvitePlayer == null || lmInvitePlayer == null">
										请先分别设置部落和联盟进组宏角色 --- 对角色右击选择“提升为主助理”
									</view> -->
									<search-complete-char :addLoading="addLoading" :diandian="searchDian" :loading="searchLoading" :afTime="showLeesTime" :info="searchComplateChr" @ask="ask"></search-complete-char>
								</view>
							</view>
						</block>
					</view>
					
					<view class="dr-code copy-code" @click="copyImageToClipboard()">
						<image :src="drcodeURL" class="drc" mode=""></image>
						<view class="dr-title">
							微信群二维码
						</view>
					</view>
					<view class="dr-code" style="margin-left: 0px;">
						<image :src="groupDrcodeURL" class="drc" mode=""></image>
						<view class="dr-title">
							<view class="dr-t-1">
								队伍邀请二维码
							</view>
							<view class="dr-t-w">
								（团长扫后分享）
							</view>
						</view>
					</view>
					
					<view class="wate-num">
						<view class="wate-title w-t">
							池中正在排队人数
						</view>
						<view class="wate-title" :class="{'more-zore' : wa_tank_num > 0}">
							坦克: {{wa_tank_num}}人
						</view>
						<view class="wate-title" :class="{'more-zore' : wa_nai_num > 0}">
							治疗: {{wa_nai_num}}人
						</view>
						<view class="wate-title" :class="{'more-zore' : wa_dps_num > 0}">
							输出: {{wa_dps_num}}人
						</view>
					</view>
					
				</view>

					<view class="cell-and-players" v-if="leaderManagerConnectStatus == 1">
						
						<view class="join-players">
							<view class="menus">
								<btn-a w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 0 || lmbl_type != 0" @btnClick="controlPlayerToIndex(0, 0)">待邀请({{wateNum(0)}})</btn-a>
								<btn-a w="50px" h="40px" @btnClick="copyPlayers()">拷贝</btn-a>
								<view style="width: 10px;"></view>
								<btn-a blue_type w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 0 || lmbl_type != 1" @btnClick="controlPlayerToIndex(0, 1)">待邀请({{wateNum(1)}})</btn-a>
								<btn-a blue_type w="50px" h="40px" @btnClick="copyPlayers()">拷贝</btn-a>
								<view style="width: 10px;"></view>
								<btn-a w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 1" @btnClick="controlPlayerToIndex(1)">队伍中({{controlPlayerData.joined_players.length}})</btn-a>
								<btn-a w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 2" @btnClick="controlPlayerToIndex(2)">已超时({{controlPlayerData.timeout_players.length}})</btn-a>
								<btn-a w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 3" @btnClick="controlPlayerToIndex(3)">已退组({{controlPlayerData.out_players.length}})</btn-a>
							</view>
							<view class="jplayers">
								
								<scroll-view scroll-y class="scroll" v-if="controlPlayerIndex == 0">
									<view class="player-cell" v-for="(player, index) in controlPlayerData.ask_players">
										{{player.function_name}}
										<block v-if="lmbl_type == 0">
											<ask-player-cell :info="player" v-if="player.faction == '1'">
												<view class="waite-c">
													<view class="time">
														{{player.showOverTime != null ? player.showOverTime : '超时'}}
													</view>
													<!-- <btn-a w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 0" @btnClick="controlPlayerToIndex(0)">复制宏</btn-a> -->
												</view>
											</ask-player-cell>
										</block>
										<block v-else>
											<ask-player-cell :info="player" v-if="player.faction != '1'">
												<view class="waite-c">
													<view class="time">
														{{player.showOverTime != null ? player.showOverTime : '超时'}}
													</view>
													<!-- <btn-a w="100px" h="40px" :itisMenuUnselected="controlPlayerIndex != 0" @btnClick="controlPlayerToIndex(0)">复制宏</btn-a> -->
												</view>
											</ask-player-cell>
										</block>
									</view>
								</scroll-view>
								<scroll-view scroll-y class="scroll" v-if="controlPlayerIndex == 1">
									<view class="player-cell" v-for="(player, index) in controlPlayerData.joined_players">
										<ask-player-cell :info="player"></ask-player-cell>
									</view>
								</scroll-view>
								<scroll-view scroll-y class="scroll" v-if="controlPlayerIndex == 2">
									<view class="player-cell" v-for="(player, index) in controlPlayerData.timeout_players">
										<ask-player-cell :info="player"></ask-player-cell>
									</view>
								</scroll-view>
								<scroll-view scroll-y class="scroll" v-if="controlPlayerIndex == 3">
									<view class="player-cell" v-for="(player, index) in controlPlayerData.out_players">
										<ask-player-cell :info="player"></ask-player-cell>
									</view>
								</scroll-view>
								
							</view>
						</view>
						
						<view v-if="baseInfo != null">
							<cell :players="cellPlayers" :redLev="parseInt(baseInfo.ins_info.item_level)"></cell>
						</view>
						
					</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	
	import bossItem from '@/components/boss-item/boss-item.vue'
	import btnA from '@/components/btn-a/btn-a.vue'
	import lfSelect from '@/components/lf-select/lf-select.vue'
	import cell from '@/components/cell/cell.vue'
	import leaderManagerError from '@/components/leader-manager-error/leader-manager-error.vue'
	import playerCell from '@/components/player-cell/player-cell.vue'
	import askPlayerCell from '@/components/ask-player-cell/ask-player-cell.vue'
	import { api } from '@/api.js'
	
	export default {
		components: {
			bossItem,
			btnA,
			lfSelect,
			cell,
			leaderManagerError,
			playerCell,
			askPlayerCell
		},
		data() {
			return {
				groupDrcodeURL: '',
				drcodeURL: '',
				blInvitePlayer: null,
				lmInvitePlayer: null,
				addLoading: false,
				timer: null,
				leaderManagerConnectStatus: 0,
				leaderManagerErrorTitle: "连接中",
				gid: null,
				boss: [],
				killingIndex: -1,
				filter_s: 0,
				filterRange: [
					{
						value: 0,
						text: '全部',
						color: 'wheat',
						sqec_list: [
							{
								spec_name: '坦克',
								icon: '/static/Tank_icon.png',
								role: 'Tank'
							},
							{
								spec_name: '治疗',
								icon: '/static/Healer_icon.png',
								role: 'Healer'
							},
							{
								spec_name: '输出',
								icon: '/static/DPS_icon.png',
								role: 'DPS'
							}
						]
					}
				],
				baseInfo: null,
				allNum: 30,
				TankNum: 1,
				tankRange: [
					{value: 0, text: "1人" },
					{value: 1, text: "2人" },
					{value: 2, text: "3人" },
					{value: 3, text: "4人" },
					{value: 4, text: "5人" }
				],
				HealerNum: 4,
				helthRange: [
					{value: 0, text: "1人" },
					{value: 1, text: "2人" },
					{value: 2, text: "3人" },
					{value: 3, text: "4人" },
					{value: 4, text: "5人" },
					{value: 5, text: "6人" },
					{value: 6, text: "7人" },
					{value: 7, text: "8人" },
					{value: 8, text: "9人" },
					{value: 9, text: "10人" }
				],
				DPSNum: 8,
				dpsRange: [
					{ value: 0, text: "15人" },
					{ value: 1, text: "16人" },
					{ value: 2, text: "17人" },
					{ value: 3, text: "18人" },
					{ value: 4, text: "19人" },
					{ value: 5, text: "20人" },
					{ value: 6, text: "21人" },
					{ value: 7, text: "22人" },
					{ value: 8, text: "23人" },
					{ value: 9, text: "24人" },
					{ value: 10, text: "25人" },
					{ value: 11, text: "26人" },
					{ value: 12, text: "27人" },
					{ value: 3, text: "28人" },
				],
				classMap: {
					1: "战士",
					2: "圣骑士",
					3: "猎人",
					4: "潜行者",
					5: "牧师",
					6: "死亡骑士",
					7: "萨满祭司",
					8: "法师",
					9: "术士",
					A: "武僧",
					B: "德鲁伊",
					C: "恶魔猎手",
					D: "唤魔师"
				},
				currentBasePlayers: [],
				cellPlayers: [[], [], [], [], [], []],
				searchComplateChr: null,
				lessTime: 0,
				showLeesTime: '02 : 00',
				searchLoading: false,
				searchDian: '.',
				doOverloading: false,
				doFinishLoading: false,
				controlPlayerData: {
					ask_players: [],
					timeout_players: [],
					out_players: [],
					joined_players: []  // 加入后的玩家
				},
				controlPlayerIndex: 0,
				roleCount: {
					DPS_count: 0,
					Tank_count: 0,
					Healer_count: 0
				},
				roleNeedCount: {
					DPS_num: 0,
					Tank_num: 0,
					Healer_num: 0
				},
				gatherPlayerName: '',
				pids: [],
				basePids: [],
				currentPid: -1,
				pas: false,
				killedBoss: [],
				BossMapping: {
					["磨轮号"]: "维克茜和磨轮",
					["弗莱兰多"]: "血腥大熔炉",
					["托克"]: "血腥大熔炉",
					["里克·混响"]: "里克·混响",
					["斯提克斯·堆渣"]: "斯提克斯·堆渣",
					["链齿狂人洛肯斯多"]: "链齿狂人洛肯斯多",
					["独臂盗匪"]: "独臂盗匪",
					["穆格·兹伊"]: "穆格·兹伊，安保头子",
					["铬武大王加里维克斯"]: "铬武大王加里维克斯"
				},
				fileLists: [],
				upedPhotoURLS: [],
				task_ok_desc: '',
				lmbl_type: 0,
				upToCloudTime: 0,
				getNeedCountTime: 0,
				wateJoinTime: 0,
				wa_nai_num: 0,
				wa_dps_num: 0,
				wa_tank_num: 0
			}
		},
		
		onLoad() {
			
			this.loadBaseInfo()
			this.loadAllClass()
			this.loadAskPlayers()
			this.loadDRCode()
			
			window.electronAPI.wowLeaderMessage((ok, message, pids) => {
				if (ok) {
					if (!this.pas) {
						this.leaderManagerConnectStatus = 1
						this.marginPids(pids)
						this.marginStrData(message)
					}
				} else {
					this.leaderManagerConnectStatus = -1
					this.leaderManagerErrorTitle = message
				}
			})
		
			this.leaderManagerConnectStatus = 0
			this.leaderManagerErrorTitle = "团长插件连接中..."
			// uni.connectSocket({
			// 	url: 'ws://127.0.0.1:8082/ws'
			// })
			// uni.onSocketOpen(() => {
			// 	console.log('connect ok')
			// 	this.leaderManagerConnectStatus = -1
			// 	this.leaderManagerErrorTitle = "团长插件连接失败，请确保团长插件工具已打开。"
			// })
			// uni.onSocketError(() => {
			// 	console.log('connect error')
			// 	this.leaderManagerConnectStatus = -1
			// 	this.leaderManagerErrorTitle = "团长插件连接失败，请确保团长插件工具已打开。"
			// })
			// uni.onSocketMessage((res) => {
			// 	this.leaderManagerConnectStatus = 1 
			// 	this.marginStrData(res.data)
			// })
			
			if (this.timer == null) {
				this.timer = setInterval(() => {
					if (this.searchComplateChr != null) {
						this.nextTimer()
					}
					this.searchDian += '.'
					if (this.searchDian.length > 4) {
						this.searchDian = '.'
					}
					let delIndexPath = []
					let index = 0
					for (let player of this.controlPlayerData.ask_players) {
						player.player_timeout_time = player.player_timeout_time - 1
						if (player.player_timeout_time <= 0) {
							delIndexPath.push(index)
						} else {
							player.showOverTime = this.formatTime(player.player_timeout_time - 60)
						}
						index++
					}
					// 将时间到了的角色移到已超时中
					for (let i of delIndexPath) {
						let statusChangePlayer = this.controlPlayerData.ask_players[i]
						statusChangePlayer.status = 4
						this.controlPlayerData.timeout_players.push(statusChangePlayer)
						this.controlPlayerData.ask_players.splice(i, 1)
					}
				}, 1000)
			}
		},
		
		onUnload() {
			this.timer = null
			window.electronAPI.removeWowLeaderMessage()
		},
		 
		methods: {
			
			async copyImageToClipboard() {
			  const result = await window.electronAPI.copyImage(this.drcodeURL);
			  uni.showToast({
			  	title: result.message
			  })
			},
			
			/**
			 * 拷贝所有待邀请玩家到剪贴板
			 */
			copyPlayers() {
				let copyStr = ''
				for (let player of this.controlPlayerData.ask_players) {
					if (this.lmbl_type == 0) {
						if (player.player_timeout_time - 60 > 0 && player.faction == 1) {
							copyStr += player.name + '-' + player.server_name + ','
						}
					} else {
						if (player.player_timeout_time - 60 > 0 && player.faction == 2) {
							copyStr += player.name + '-' + player.server_name + ','
						}
					}
				}
				copyStr = copyStr.substring(0, copyStr.length - 1)
				uni.setClipboardData({
					data: copyStr,
					success: () => {
						uni.showToast({
							title: '拷贝成功'
						})
					}
				});
			},
			
			marginPids(pids) {
				let ps = []
				let index = 0
				let currentPidInit = false
				for (let p of pids) {
					ps.push({
						value: index++,
						text: p.name + ' - ' + p.pid
					})
					if (p.pid == this.currentPid) {
						currentPidInit = true
					}
				}
				this.pids = ps
				this.basePids = pids
				if (!currentPidInit) {
					this.currentPid = 0
				}
				// if (this.currentPid == -1) {
				// 	this.currentPid = 0
				// } else {
				// 	if (!currentPidInit) {
				// 		this.currentPid = 0
				// 	}
				// }
			},
			
			pidChanged(e) {
				this.pas = true
				this.currentPid = e
				this.leaderManagerConnectStatus = -1
				this.leaderManagerErrorTitle = '进程切换中'
				window.electronAPI.setCurrentPid(this.basePids[e].pid)
				setTimeout(() => {
					this.lmInvitePlayer = null
					this.blInvitePlayer = null
					this.pas = false
				}, 1000)
			},
			
			generate5DigitShuffledNumber(input, seed) {
			    // 将输入转换为数字
			    let num = Number(input);
			    if (isNaN(num)) {
			        return "Invalid input"; // 如果输入不是有效数字
			    }
			
			    // 基础混淆操作
			    num = num + seed;           // 加上一个常数
			    num = num * 5;              // 乘以一个常数
			    num = num - (seed * 2);     // 减去种子的一部分
			    num = num + 100000;         // 确保结果大于100000
			
			    // 使结果始终为5位数字
			    num = (num % 90000) + 10000; // 使范围保持在 10000 到 99999 之间
			
			    // 返回最终的5位数字
			    return num;
			},
			
			todayTime() {
			    const now = new Date();
			    let year = now.getFullYear().toString().slice(-1); // 获取年份最后一位
			    let month = String(now.getMonth() + 1).padStart(2, '0'); // 月份补零
			    let day = String(now.getDate()).padStart(2, '0'); // 日期补零
			
			    // 拼接成字符串后转换为数字
			    return Number(year + month + day);
			},

			
			resetRoleCount() {
				
				let temp = {
					DPS_count: 0,
					Tank_count: 0,
					Healer_count: 0
				}
				
				let tempCount
				for (let player of this.controlPlayerData.ask_players) {
					tempCount = parseInt(temp[player.role + '_count']) + 1
					temp[player.role + '_count'] = tempCount
				}
				for (let player of this.controlPlayerData.joined_players) {
					tempCount = parseInt(temp[player.role + '_count']) + 1
					temp[player.role + '_count'] = tempCount
				}
				for (let p of this.currentBasePlayers) {
					// if (!p.cloud && (p.player_type == 1 || p.player_type == 3)) {
					// 	tempCount = parseInt(temp[p.role + '_count']) + 1
					// 	temp[p.role + '_count'] = tempCount
					// }
					if (!p.cloud) {
						tempCount = parseInt(temp[p.role + '_count']) + 1
						temp[p.role + '_count'] = tempCount
					}
				}
				this.roleCount = temp
			},
			
			/**
			 * 判断是否缺人，需要拉人
			 */
			checkRoleNotice() {
				
				const currentTime = Math.floor(Date.now() / 1000);
				if (currentTime - this.getNeedCountTime <= 5) return
				this.getNeedCountTime = currentTime
				
				api.get({
					url: api.group___auth_quequ_player_count(),
					data: {
						gid: this.gid
					},
					success: (res) => {
						this.wa_nai_num = res.data.nai_num
						this.wa_dps_num = res.data.dps_num
						this.wa_tank_num = res.data.tank_num
						
						// 下面代码在判断排队池中是否有玩家
						const need_tank_num = this.TankNum + 1
						const need_dps_num = this.DPSNum + 1
						const need_nai_num = this.HealerNum + 1
						const tankTr = this.roleCount.Tank_count < need_tank_num
						const healerTr = this.roleCount.Healer_count < need_nai_num
						const dpsTr = this.roleCount.DPS_count < need_dps_num
						
						let body = ''
						if (tankTr && res.data.tank_num > 0) {
							body = '坦克:' + res.data.tank_num + '人、'
						}
						if (healerTr && res.data.nai_num > 0) {
							body = '治疗:' + res.data.nai_num + '人、'
						}
						if (dpsTr && res.data.dps_num > 0) {
							body = '输出' + res.data.dps_num + '人、'
						}
						if (body != '') {
							body = body.slice(0, -1)
							if (tankTr || healerTr || dpsTr) {
								window.electronAPI.isMainWindowFocused().then((focused) => {
									if (!focused && this.killingIndex == -1) {
										window.electronAPI.notice('系统检测到还有排队玩家，请及时处理', body)
									} else {
										console.log('焦点状态，不检测')
									}
								})
							}
						}
					}
				})
				
				
				// 判断是否有待邀请的玩家还没有进组
				
				
				
			},
			
			controlPlayerToIndex(index, type) {
				this.controlPlayerIndex = index
				this.lmbl_type = type
			},
			
			loadAskPlayers() {
				api.get({
					url: api.group___auth_group_char(),
					data: {
						gid: this.gid
					},
					success: (res) => {
						
						let ask_players = []
						let timeout_players = []
						let out_players = []
						let joined_players = []
						
						for (let p of res.data.list) {
							if (p.status == 2) {
								p.showOverTime = this.formatTime(p.player_timeout_time)
								ask_players.push(p)
							}
							if (p.status == 4) {
								// p.showOverTime = this.formatTime(res.data.player_timeout_time)
								timeout_players.push(p)
							}
							if (p.status == 3) {
								// p.showOverTime = this.formatTime(res.data.player_timeout_time)
								joined_players.push(p)
							}
							if (p.status == 5) {
								// p.showOverTime = this.formatTime(res.data.player_timeout_time)
								out_players.push(p)
							}
						}
						
						this.controlPlayerData = {
							ask_players: ask_players,
							timeout_players: timeout_players,
							out_players: out_players,
							joined_players: joined_players
						}
					},
					fail: (error) => {
						
					}
				})
			},
			
			deepClone(obj) {
				
			    if (obj === null || typeof obj !== 'object') {
			        return obj // 如果是原始类型，直接返回
			    }
			
			    // 处理日期对象
			    if (obj instanceof Date) {
			        return new Date(obj)
			    }
			
			    // 处理正则对象
			    if (obj instanceof RegExp) {
			        return new RegExp(obj)
			    }
			
			    // 创建一个新对象或数组
			    const clone = Array.isArray(obj) ? [] : {}
			
			    // 递归拷贝每个属性
			    for (const key in obj) {
			        if (obj.hasOwnProperty(key)) {
			            clone[key] = this.deepClone(obj[key])
			        }
			    }
			
			    return clone
			},
			
			ask(info) {
				
				this.addLoading = true
				api.get({
					url: api.group___auth_invite_player(),
					data: {
						qid: info.qid
					},
					success: (res) => {
						this.addLoading = false
						this.searchComplateChr = null
						this.lessTime = 0

						res.data.showOverTime = this.formatTime(res.data.player_timeout_time)
						this.controlPlayerData.ask_players.push(res.data)
						this.removeUnwatingPlayer(res.data)
						
						this.resetRoleCount()
					},
					fail: (error) => {
						this.addLoading = false
						uni.showModal({
							content: error,
							showCancel: false
						})
					}
				})
			},
			
			
			removeUnwatingPlayer(player) {
				
				let index = 0
				for (let p of this.controlPlayerData.timeout_players) {
					if (p.name == player.name && p.server_name == player.server_name) {
						this.controlPlayerData.timeout_players.splice(index, 1)
						return
					}
					index++
				}
				index = 0
				for (let p of this.controlPlayerData.out_players) {
					if (p.name == player.name && p.server_name == player.server_name) {
						this.controlPlayerData.out_players.splice(index, 1)
						return
					}
					index++
				}
			},
			
			photoDelete(e) {
				this.fileLists.splice(e.index, 1)
			},
			
			photoSelected(e) {
				this.fileLists = this.fileLists.concat(e.tempFiles)
			},
			
			groupSubmit() {
				
				if (this.task_ok_desc.length == 0) {
					uni.showModal({
						content: '请先填写备注说明',
						showCancel: false
					})
					return
				}
				if (this.fileLists.length == 0) {
					uni.showModal({
						content: '请上传说明图片图片',
						showCancel: false
					})
					return
				}
				this.upedPhotoURLS = []
				api.get({
					url: api.upload___auth_jstoken(),
					success: (res) => {
						this.fileLists.forEach((filet, index) => {
						  uni.uploadFile({
						    url: 'https://upload.qiniup.com', // 替换成七牛云上传域名
						    filePath: filet.path,
						    name: 'file',
						    formData: {
						      token: res.data.uptoken,
						      key: 'wow/tuanz_app/' + filet.cloudPath,
						    },
						    success: (uploadRes) => {
						      const data = JSON.parse(uploadRes.data);
						      const imageUrl = `${res.data.domain}/${data.key}`;
						      console.log(index + ' 图片地址：', imageUrl);
								this.upedPhotoURLS.push(imageUrl)
						      // 确保最后一个回调时才执行“上传完成”
						      if (this.upedPhotoURLS.length === this.fileLists.length) {
						        console.log('上传完成');
								this.finisGroup(this.upedPhotoURLS)
						      }
						    },
						    fail: (err) => {
						      console.log('上传失败', err);
						    }
						  });
						});	  
					},
					fail: (error) => {
						console.log(error)
					}
				})
				
			},
			
			submitFinish() {

				// 移除 不监控boss进度
				// if (this.killedBoss.length < this.baseInfo.kill_boss.length) {
				// 	this.$refs.groupFinish.open('center')
				// } else {
				// 	this.finisGroup()
				// }
				this.finisGroup()
			},
			
			finisGroup(task_ok_imgs) {
				let postd = {
					gid: this.gid
				}
				if (task_ok_imgs) {
					postd.task_ok_imgs = task_ok_imgs
					postd.task_ok_desc = this.task_ok_desc
				}
				this.doFinishLoading = true
				api.post({
					url: api.group___auth_ok_group(),
					data: postd,
					success: (re) => {
						this.doFinishLoading = false
						api.removeCurrent()
						uni.reLaunch({
							url: '/pages/root/root'
						})
					},
					fail: (error) => {
						this.doFinishLoading = false
						uni.showModal({
							content: error,
							showCancel: false
						})
					}
				})
			},
			
			removeGid() {
				uni.showModal({
					title: '温馨提示',
					content: '若强行摧毁队伍，本次开团将不被正常计入完成次数。',
					confirmText: '强行摧毁',
					complete: (res) => {
						if (res.confirm) {
							this.doOverloading = true
							api.post({
								url: api.group___auth_jieshan(),
								data: {
									gid: this.gid
								},
								success: (re) => {
									this.doOverloading = false
									api.removeCurrent()
									uni.reLaunch({
										url: '/pages/root/root'
									})
								},
								fail: (error) => {
									this.doOverloading = false
									uni.showModal({
										content: error,
										showCancel: false
									})
								}
							})
						}
					}
				})
			},
			
			formatTime(seconds) {
				
				if (seconds < 0) {
					return null
				}
				
			    const minutes = Math.floor(seconds / 60);
			    const remainingSeconds = seconds % 60;
			
			    // 使用 padStart 来确保数字为两位
			    const formattedMinutes = String(minutes).padStart(2, '0');
			    const formattedSeconds = String(remainingSeconds).padStart(2, '0');
			
			    return `${formattedMinutes} : ${formattedSeconds}`;
			},
			
			nextTimer() {
				this.lessTime = this.lessTime - 1
				if (this.lessTime <= 0) {
					this.lessTime = 0
					
					// 调用过掉这个角色，也有可能是服务器控制
					this.searchComplateChr = null
					
					return
				}
				this.showLeesTime = this.formatTime(this.lessTime)
			},
			
			findPlayer(index) {
				if (this.searchLoading) return
				let filterData = {
					gid: this.gid,
					role: this.filterRange[this.filter_s].sqec_list[index].role
				}
				if (this.filter_s > 0) {
					filterData.class_id = this.filterRange[this.filter_s].sqec_list[index].class_id
					filterData.sqec_id = this.filterRange[this.filter_s].sqec_list[index].id
				}
				this.searchLoading = true
				api.get({
					url: api.group___auth_find_player(),
					data: filterData,
					success: (res) => {
						this.searchComplateChr = res.data
						this.lessTime = 120
						this.searchLoading = false
					},
					fail: (error) => {
						this.searchComplateChr = null
						this.searchLoading = false
					}
				})
			},
			
			sqecToRole(class_name, spec_name) {
				let reObj = {
					role: "none",
					color: "#636363"
				}
				let role = "none"
				for (let s of this.filterRange) {
					if (s.text == class_name) {
						for (let sqe of s.sqec_list) {
							if (sqe.spec_name == spec_name) {
								role = sqe.role
								break
							}
						}
						reObj = {
							role: role,
							color: s.color
						}
						break
					}
				}
				return reObj
			},
			
			validateSplitString(str) {
				// console.log(str)
			    // 以井号 # 分割字符串
			    const parts = str.split('#')
			    // 如果没有井号，或者井号后没有数据
			    if (parts.length != 2 || parts[1].trim() === '') {
					// console.log(parts)
			        throw new Error('#-左上角通信码被挡住或还未进入游戏');
			    }
			    return parts
			},
			
			validateSplitStrPlayer(str) {
				const players = str.split(',')
				// if (parts.length != 2 || parts[1].trim() === '') {
				//     throw new Error('左上角通信码被挡住了');
				// }
				return players
			},
			
			marginPlayers(playerStrs) {
				// console.log(playerStrs)
				if (this.leaderManagerConnectStatus != 1) return
				let players = []
				for (let pstr of playerStrs) {
					const pStrInfo = pstr.split(':')
					let pla
					try {
						if (pStrInfo.length != 9 || pStrInfo[8].trim() === '') {
							// console.log(pStrInfo)
						    throw new Error('##-左上角通信码被挡住或还未进入游戏')
						}
						// 特殊号 1:进组宏且是当前角色 2:仅进组宏号 3:仅当前角色 0:普通号
						// 阵营:专精:角色名字:服务器:平均装等:队伍:特殊号:在线:职业
						const rc = this.sqecToRole(this.classMap[pStrInfo[8]], pStrInfo[1])

						pla = {
							function_name: pStrInfo[0],
							spec_name: pStrInfo[1],
							name: pStrInfo[2],
							server_name: pStrInfo[3],
							item_lev: pStrInfo[4],
							goup_index: pStrInfo[5],
							player_type: parseInt(pStrInfo[6]),
							online: pStrInfo[7],
							class_name: this.classMap[pStrInfo[8]],
							role: rc.role,
							color: rc.color
						}
					} catch {
						// console.log(pstr)
						throw new Error('##-左上角通信码被挡住或还未进入游戏')
					}
					
					players.push(pla)
				}
				
				for (let pla of players) {
					this.marginAddPlayerToJoinedTeamACloudPlayer(pla)
				}
				/*
				let blOK = false
				let lmOK = false
				for (let pla of players) {
					// 进组宏
					if (pla.player_type == 1 || pla.player_type == 2) {
						if (pla.function_name == '部落') {
							// 没有上传过部落宏 或者 上次上传的和这次不同
							if (this.blInvitePlayer == null || (pla.name != this.blInvitePlayer.name && pla.server_name != this.blInvitePlayer.server_name)) {
								// 上传宏
								this.blInvitePlayer = pla
								this.save_hong(pla, (ok) => {
									if (!ok) {
										this.blInvitePlayer = null
									}
								})
							}
							blOK = true
						} else if (pla.function_name == '联盟') {
							// 没有上传过部落宏 或者 上次上传的和这次不同
							if (this.lmInvitePlayer == null || (pla.name != this.lmInvitePlayer.name && pla.server_name != this.lmInvitePlayer.server_name)) {
								// 上传宏
								this.lmInvitePlayer = pla
								this.save_hong(pla, (ok) => {
									if (!ok) {
										this.lmInvitePlayer = null
									}
								})
							}
							lmOK = true
						}
					}
				}
				
				if (!blOK) {
					this.blInvitePlayer = null
				}
				if (!lmOK) {
					this.lmInvitePlayer = null
				}
				for (let pla of players) {
					if (this.blInvitePlayer != null && this.lmInvitePlayer != null) {
						this.marginAddPlayerToJoinedTeamACloudPlayer(pla)
						// 判断是否是已经退队的角色，是就需要变回已进组中去 , 不能自动操作，让团长手动
						// this.cellPlayerFromOutNeedBack(pla)
						// players.push(pla)
					}
				}
				*/
				
				
				return players
			},
			
			cellPlayerFromOutNeedBack(player) {
				// 判断是否是已经退队的角色，是就需要变回已进组中去
				// TODO
				const index = this.controlPlayerData.out_players.findIndex(p => (p.name == player.name && p.server_name == player.server_name));

				if (index !== -1) {
					
					let joinPlayer = {...this.controlPlayerData.out_players[index]}

					if (joinPlayer?.gcid) {
						// 请求接口同步到服务器 添加了一个匹配了且被玩家邀请了的玩家
						api.get({
							url: api.group___auth_update_player_join_group(),
							data: {
								gcid: joinPlayer.gcid
							},
							success: (res) => {
								// const index = arr.indexOf(valueToRemove);
								// if (index !== -1) arr.splice(index, 1);
								// 需要在这个地方移除 把joinPlayer从this.controlPlayerData.ask_players数组中移除
								const i = this.controlPlayerData.out_players.findIndex(p => p.gcid === joinPlayer.gcid);
								if (i !== -1) {
									this.controlPlayerData.out_players.splice(i, 1);
								}
								// 将joinPlayer添加到joinedPlayers中
								joinPlayer.status = 3
								// 将小程序数据给cell框架
								
								for (let cp of this.currentBasePlayers) {
									if (cp.name == player.name && cp.server_name == player.server_name) {
										cp.cloud = joinPlayer
										console.log(cp)
									}
								}
								this.currentBasePlayers = this.currentBasePlayers
								this.controlPlayerData.joined_players.push(joinPlayer)
								this.resetRoleCount()
							}
						})
					} else {
						// 判断这个玩家是否在已经加入队伍的数组中
						for (let jPlayer of this.controlPlayerData.joined_players) {
							if (jPlayer.name == player.name && jPlayer.server_name == player.server_name) {
								// 将小程序数据给cell框架
								player.cloud = jPlayer
								break
							}
						}
					}
				}
				
			},
			
			/**
			 * 整理判断这个玩家是否已经入队
			 * 如果第一次进队伍了，同步到服务器
			 * 如果之前已经同步过了，将服务器角色数据添加到cell数据中
			 * @param {Object} player 角色
			 */
			marginAddPlayerToJoinedTeamACloudPlayer(player) {
				// controlPlayerData: {
				// 	ask_players: [],
				// 	timeout_players: [],
				// 	out_players: [],
				// 	joined_players: []  // 加入后的玩家
				// },
				// 判断是否是新增玩家
				// let gcid = null
				let joinPlayer = null
				for (let askPlayer of this.controlPlayerData.ask_players) {
					if (askPlayer.name == player.name && askPlayer.server_name == player.server_name) {
						// gcid = askPlayer.gcid
						joinPlayer = {...askPlayer}
						// joinPlayer = askPlayer
						break
					}
				}
				
				if (joinPlayer?.gcid) {
					// 请求接口同步到服务器 添加了一个匹配了且被玩家邀请了的玩家
					api.get({
						url: api.group___auth_update_player_join_group(),
						data: {
							gcid: joinPlayer.gcid
						},
						success: (res) => {
							// const index = arr.indexOf(valueToRemove);
							// if (index !== -1) arr.splice(index, 1);
							// 需要在这个地方移除 把joinPlayer从this.controlPlayerData.ask_players数组中移除
							const index = this.controlPlayerData.ask_players.findIndex(p => p.gcid === joinPlayer.gcid);
							if (index !== -1) {
								this.controlPlayerData.ask_players.splice(index, 1);
							}
							// 将joinPlayer添加到joinedPlayers中
							joinPlayer.status = 3
							// 将小程序数据给cell框架
							player.cloud = joinPlayer
							this.controlPlayerData.joined_players.push(joinPlayer)
							this.marginPlayerToCell()
						}
					})
				} else {
					// 判断这个玩家是否在已经加入队伍的数组中
					for (let jPlayer of this.controlPlayerData.joined_players) {
						if (jPlayer.name == player.name && jPlayer.server_name == player.server_name) {
							// 将小程序数据给cell框架
							player.cloud = jPlayer
							break
						}
					}
				}
			},

			marginPlayerToCell() {
				let cellPls = [[], [], [], [], [], []]
				for (let player of this.currentBasePlayers) {
					if (player.goup_index > 6) continue
					cellPls[player.goup_index - 1].push(player)
				}
				// console.log(cellPls)
				// this.setData({
				// 	cellPlayers: cellPls
				// })
				this.$set(this, 'cellPlayers', cellPls);
				// this.cellPlayers = cellPls
			},
			
			marginOutPlayerToCloud() {
				// 反过来在已加入队伍中查看cell中的数据，筛选出已经退组的成员，并请求接口
				// 不在实时数据的角色
				let removeTempPlayer
				let inCurrent
				for (let player of this.controlPlayerData.joined_players) {
					inCurrent = false
					// console.log(this.currentBasePlayers)
					for (let p_p of this.currentBasePlayers) {
						if (player.name == p_p.name && p_p.server_name == player.server_name) {
							inCurrent = true
						}
					}
					// 已经不在了，退出去了
					if (!inCurrent) {
						// this.controlPlayerData.out_players
						removeTempPlayer = {...player}
						api.get({
							url: api.group___auth_update_player_leave_group(),
							data: {
								gcid: player.gcid
							},
							success: (res) => {
								
								const index = this.controlPlayerData.joined_players.findIndex(p => p.gcid === removeTempPlayer.gcid);
								if (index !== -1) {
									this.controlPlayerData.joined_players.splice(index, 1);
								}
								// 将joinPlayer添加到joinedPlayers中
								removeTempPlayer.status = 5
								this.controlPlayerData.out_players.push(removeTempPlayer)
								this.resetRoleCount()
							}
						})
						
						
					}
				}
			},
			
			saveBossStatus(boss) {
				let postData = {
					gid: this.gid,
					group_boss: {
						boss_id: boss.boss_id,
						kill_status: boss.kill_status
					}
				}
				api.post({
					url: api.group___auth_save_group_info(),
					json: true,
					data: postData
				})
			},
			
			validateSplitStrOtherInfo(str) {
				const othserInfos = str.split(':')
				this.gatherPlayerName = othserInfos[0]
				let killingBossName = othserInfos[1]
				let lastKilledBoss = othserInfos[2]
				if (killingBossName != '0') {
					killingBossName = this.BossMapping[killingBossName]
				}
				if (lastKilledBoss != '0') {
					lastKilledBoss = this.BossMapping[lastKilledBoss]
				}
				if (killingBossName == '0') {
					if (this.killingIndex != -1) {
						// 将刚刚击杀中的boss状态改回来，服务器
						// 如果是已经击杀掉了，则不做任何处理
						const index = this.killedBoss.findIndex((b) => {
							return b.bossInfo.boss_name === this.boss[this.killingIndex].bossInfo.boss_name
						})
						// 刚刚击杀中的boss并非在死亡boss中，也不是最后一次击杀的boss，状态要更新回来
						if (index === -1 && this.boss[this.killingIndex].bossInfo.boss_name != lastKilledBoss) {
							
							// 提交网络数据
							this.boss[this.killingIndex].kill_status = '0'
							this.saveBossStatus(this.boss[this.killingIndex])
						}
						this.killingIndex = -1
					}
				} else {
					const index = this.boss.findIndex((b) => {
						return b.bossInfo.boss_name === killingBossName
					})
					if (this.killingIndex !== index) {
						this.killingIndex = index
						// 正在击杀的boss提交数据
						this.boss[index].kill_status = '1'
						this.saveBossStatus(this.boss[this.killingIndex])
					}
				}
				
				if (lastKilledBoss != '0') {
					const index = this.killedBoss.findIndex((boss) => {
						return boss.bossInfo.boss_name === lastKilledBoss
					})
					if (index === -1) {
						const i = this.boss.findIndex((boss) => {
							return boss.bossInfo.boss_name === lastKilledBoss
						})
						this.boss[i].kill_status = '2'
						this.killedBoss.push(this.boss[i])
						this.saveBossStatus(this.boss[i])
					}
				}
			},
			
			/**
			 * 提交cell数据到服务器
			 */
			saveCellInfoToCloud() {
				
				const currentTime = Math.floor(Date.now() / 1000);
				if (currentTime - this.upToCloudTime <= 60) return
				this.upToCloudTime = currentTime
				
				let postData = {
					gid: this.gid,
				}
				
				let player_list = []
				for (let players of this.cellPlayers) {
					for (let player of players) {
						player_list.push({
							name: player.name,
							class_id: player.class_name,
							sqec_id: player.spec_name,
							item_level: player.item_lev,
							is_duizhang: (player.player_type == 1 || player.player_type == 3) ? 1 : 0,
							role_type: player.role,
							server_name: player.server_name,
							function_name: player.function_name,
							color: player.color,
							online: player.online
						})
					}
				}
				postData.player_list = player_list
				api.post({
					url: api.group___auth_report_player(),
					json: true,
					data: postData,
					success: (res) => {
						
					},
					fail: (error) => {
						
					}
				})
			},
			
			marginStrData(str) {
				
				try {
				    const baseData = this.validateSplitString(str)
					
					// 解析其他数据，包含boss信息
					this.validateSplitStrOtherInfo(baseData[1])
					// 解析当前人员
					this.currentBasePlayers = this.marginPlayers(this.validateSplitStrPlayer(baseData[0]))
					// 反过来在已加入队伍中查看cell中的数据，筛选出已经退组的成员，并请求接口
					this.marginOutPlayerToCloud()
					// 整理当前cell框架
					this.marginPlayerToCell()
					// 重置位置人口
					this.resetRoleCount()
					// 上报当前队伍数据
					this.saveCellInfoToCloud()
					// console.log(this.currentBasePlayers)
					// 判定队伍人数是否通知缺人
					this.checkRoleNotice()
					
				} catch (e) {
				    console.error(e.message); // 异常情况
					if (this.leaderManagerConnectStatus != -2) {
						this.leaderManagerConnectStatus = 0
					}
					this.leaderManagerErrorTitle = e.message
				}
			},
			
		
			loadAllClass() {
				
				api.get({
					url: api.user___classes(),
					success: (res) => {
						let filterRange = this.filterRange
						let index = 1
						for (let cl of res.data.list) {
							filterRange.push({
								value: index++,
								text: cl.class_name,
								icon: cl.icon,
								sqec_list: cl.sqec_list,
								color: cl.color
							})
						}
						this.filterRange = filterRange
						// console.log(this.filterRange)
					},
					fail: (error) => {
						
					}
				})
			},
			
			configData() {
				this.boss = this.baseInfo.kill_boss
				let killedBoss = []
				let index = 0
				for (let b of this.baseInfo.kill_boss) {
					if (b.kill_status == '2') {
						killedBoss.push(b)
					}
					if (b.kill_status == '1') {
						this.killingIndex = index
					}
					index++
				}

				this.killedBoss = killedBoss
				this.TankNum = this.baseInfo.group_info.need_tank_num - 1
				this.HealerNum = this.baseInfo.group_info.need_nai_num - 1
				this.DPSNum = this.baseInfo.group_info.need_dps_num - 15
				this.roleNeedCount = {
					DPS_num: this.DPSNum + 15,
					Tank_num: this.TankNum + 1,
					Healer_num: this.HealerNum + 1
				}
			},
			
			loadDRCode() {
				const token = uni.getStorageSync('token')
				this.drcodeURL = api.user___auth_tg_qrcode() + '?gid=' + this.gid + '&token=' + token
				this.groupDrcodeURL = api.user___auth_tg_qrcode() + '?gid=' + this.gid + '&token=' + token + '&type=1'
				// api.get({
				// 	url: api.user___auth_tg_qrcode(),
				// 	data: {
				// 		gid: this.gid
				// 	},
				// 	success: (res) => {
						
				// 	}
				// })
			},
			
			loadBaseInfo() {
				const id = api.getCurrent().id
				if (id != null) {
					this.gid = id
					api.get({
						url: api.group___auth_info(),
						data: {
							gid: api.getCurrent().id
						},
						success: (res) => {
							this.baseInfo = res.data
							this.configData()
							// console.log(res.data)
						},
						fail: (error) => {
							uni.showModal({
								content: error,
								showCancel: false,
								confirmText: '关闭',
								success: (e) => {
									if (e.confirm) {
										uni.reLaunch({
											url: '/pages/root/root'
										})
									}
								}
							})
						}
					})
				} else {
					uni.showModal({
						content: '副本信息读取错误',
						showCancel: false,
						confirmText: '关闭',
						success: (e) => {
							if (e.confirm) {
								uni.reLaunch({
									url: '/pages/root/root'
								})
							}
						}
					})
				}
			},
			
			filterChange(e) {
				this.filter_s = e
			},
			
			tankChange(e) {
				this.TankNum = e
				this.DPSNum = (30 - (e + 1 + this.HealerNum + 1)) - 15
			},
			
			helthChange(e) {
				this.HealerNum = e
				this.DPSNum = (30 - (this.TankNum + 1 + e + 1)) - 15
			},
			
			save_hong(player, callback) {
				let postData = {
					gid: this.gid,
					group: {
						save_hong: {}
					}
				}
				if (player.function_name == '联盟') {
					postData.group.save_hong.lm_hong = '/w ' + player.name + '-' + player.server_name + " " + this.generate5DigitShuffledNumber(this.todayTime(), 999)
				} else if (player.function_name == '部落') {
					postData.group.save_hong.bl_hong = '/w ' + player.name + '-' + player.server_name + " " + this.generate5DigitShuffledNumber(this.todayTime(), 999)
				}
				api.post({
					url: api.group___auth_save_group_info(),
					json: true,
					data: postData,
					success: (res) => {
						callback(true)
					},
					fail: (error) => {
						callback(false)
					}
				})
			},
			
			wateNum(type) {
				let num = 0
				if (type == 0) {
					for (let player of this.controlPlayerData.ask_players) {
						if (player.faction == 1) {
							num++
						}
					}
				} else {
					for (let player of this.controlPlayerData.ask_players) {
						if (player.faction == 2) {
							num++
						}
					}
				}
				
				if (num > 0) {
					const currentTime = Math.floor(Date.now() / 1000);
					if (currentTime - this.wateJoinTime > 5) {
						this.wateJoinTime = currentTime
						window.electronAPI.notice('还有待邀请玩家', '您还有待邀请玩家没有处理，请及时在游戏中邀请他(她)们')
					}
				}
				
				return num
			},
			
			saveChanged() {
				let postData = {
					gid: this.gid,
					group: {
						edit_need_num: {
							need_tank_num: this.TankNum + 1,
							need_dps_num: this.DPSNum + 15,
							need_nai_num: this.HealerNum + 1
						}
					}
				}
				api.post({
					url: api.group___auth_save_group_info(),
					json: true,
					data: postData,
					success: (res) => {
						this.roleNeedCount = {
							DPS_num: this.DPSNum + 15,
							Tank_num: this.TankNum + 1,
							Healer_num: this.HealerNum + 1
						}
						// console.log(res)
					},
					fail: (error) => {
						console.log(error)
					}
				})
			}
		}
	}
</script>

<style scoped>
	
	.menus {
		display: flex;
		margin-bottom: 2px;
	}
	
	.title-c {
		display: flex;
		align-items: center;
		margin-left: 50px;
		margin-top: 50px;
	}
	
	.title {
		font-weight: bold;
		font-size: 20px;
		color: #f7b10a;
	}
	
	.root{
		/* background: url("../../static/bj.jpg") no-repeat 0 0; */
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		background-color: #170e09;
		background-size: cover;
		position: relative;
	}
	
	.video-bg {
		position: absolute;
		left: 0;
		top: 0;
		right: 0;
		bottom: 0;
		overflow: hidden;
		z-index: 0;
	}
	
	.video {
		width: 100%;
		height: 100%;	
	}
	
	.cantiner {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;	
		z-index: 2;
	}
	
	.box {
		/* height: 385px; */
		width: calc(100% - 100px);
		/* max-width: 1300px; */
		min-width: 1300px;
		/* height: calc(100% - 185px - (100% - 185px * 5) + -15px); */
		/* margin-right: 300px; */
		background-color: rgba(0, 0, 0, 0.3);
		margin-left: 50px;
		margin-top: 50px;
		border: 1px rgba(0, 0, 0, 0.3) solid;
		backdrop-filter: blur(30px);
		display: flex;
		flex-direction: column;
	}
	
	.boss-box {
		margin: 40px 50px 0 50px;
		display: flex;
		align-items: center;
	}
	
	.boss {
		/* margin-right: 15px; */
		width: 120px;
		height: calc(150px / 1.8);
	}
	
	.next {
		width: 20px;
		height: 20px;
		margin-left: 10px;
		margin-right: 10px;
		margin-bottom: 22px;
	}
	
	.next-icon {
		width: 100%;
		height: 100%;
	}
	
	.select-chr {
		
		display: flex;
		align-items: center;
	}
	
	.s-title {
		color: wheat;
		margin-right: 10px;
	}
	
	.sel {
		width: 135px;
	}
	
	.submit-content {
		/* margin: 0 35px 35px 35px; */
		margin-left: 20px;
		margin-right: 20px;
		display: flex;
		align-items: center;
		width: 500px;
		height: 40px;
	}
	
	.bott {
		width: 1px;
		flex: 1;
		height: 100%;
	}
	
	.search-b {
		width: 150px;
		height: 40px;
		margin-left: 15px;
	}
	
	.search-title {
		display: flex;
		align-items: center;
	}
	
	.role-icon {
		width: 20px;
		height: 20px;
		margin-right: 5px;
		border-radius: 100%;
		border: 2px wheat solid;
	}
	
	.search-box {
		display: flex;
		flex-direction: column;
		margin-left: 50px;
		margin-top: 20px;
	}
	
	.search-complete-char {
		width: 695px;
		margin-top: 15px;
	}
	
	.leader-manager-error {
		width: 695px;
		height: 100px;
		margin-top: 50px;
		margin-left: 50px;
		margin-bottom: 50px;
	}
	
	.cell-and-players {
		margin-left: 50px; 
		margin-top: 50px;
		display: flex;
		margin-bottom: 50px;
	}

	.join-players {
		display: flex;
		flex-direction: column;
		margin-right: 20px;
	}
	
	.jplayers {
		display: flex;
		/* flex-direction: column; */
		height: 240px;
	}
	
	.scroll {
		height: 100%;
		width: 400px;
	}
	
	/deep/ ::-webkit-scrollbar {
		width: 0 !important;
		height: 0 !important;
		background: transparent !important;
	}
	
	/deep/ ::-webkit-scrollbar-thumb {
		background: transparent !important;
	}
	
	/deep/ ::-webkit-scrollbar-track {
		background: transparent !important;
	}
	
	.player-cell {
		width: 100%;
		height: 40px;
		margin-bottom: 2px;
	}
	
	.time {
		color: wheat;
		z-index: 5;
	}
	
	.gather {
		margin-left: 50px;
		margin-top: 30px;
		display: flex;
	}
	
	.gather-lf {
		margin-right: 15px; width: 200px;
	}
	
	.gather-player {
		border: 1px wheat dashed;
		border-radius: 3px;
		width: 200px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: wheat;
		box-sizing: border-box;
	}
	
	.no-invite-player {
		border: 1px wheat dashed;
		width: 100%;
		height: 80px;
		box-sizing: border-box;
		border-radius: 3px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: wheat;
		text-shadow: 0 0 2px red;
	}
	
	.group-finish-content {
		background-color: #2f2f2f;
		border-radius: 5px;
		display: flex;
		flex-direction: column;
		width: 420px;
	}
	
	.g-title {
		margin: 30px 30px 0 30px;
		text-align: center;
		font-size: 15px;
		color: wheat;
	}
	
	.example-body {
		margin: 10px 30px 0 30px;
	}
	
	.group-finis-b {
		margin: 20px 30px 30px 30px;
	}
	
	.uni-textarea {
		margin: 30px;
	}
	
	.find-box {
		display: flex;
		flex: 1;
		/* width: 1px; */
	}
	
	.find-b-left {
		display: flex;
		flex-direction: column;
	}
	
	.dr-code {
		margin: 30px 30px 0 30px;
		width: 195px;
		height: 195px;
		background-color: #fff;
		border-radius: 5px;
		display: flex;
		flex-direction: column;
		align-items: center;
		/* justify-content: center; */
	}
	
	.copy-code:hover {
		cursor: pointer;
		opacity: 0.8;
	}
	
	.copy-code:active {
		opacity: 0.9;
	}

	.dr-title {
		height: 40px;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #0aaa25;
		font-size: 14px;
		font-weight: bold;
		/* background-color: orange; */
		/* margin-top: ; */
	}
	
	
	
	.drc {
		margin-top: 16px;
		width: 130px;
		height: 130px;
	}
	
	.wate-num {
		margin: 30px 30px 0 0;
		border: 1px wheat solid;
		box-sizing: border-box;
		border-radius: 5px;
		width: 184px;
		display: flex;
		flex-direction: column;
		padding-top: 8px;
		padding-bottom: 8px;
		background-color: #ffffdb;
	}
	
	.wate-title {
		height: 1px;
		flex: 1;
		display: flex;
		align-items: center;
		margin-left: 20px;
		color: #ab894b;
		
	}
	
	.w-t {
		color: #ab894b;
		font-weight: bold;
	}
	
	.more-zore {
		/* color: red; */
		color: #ff557f;
	
		font-size: 16px;
		font-weight: bold;
		animation: mZorea 0.4s linear infinite;
	}
	
	.dr-t-1 {
		font-size: 12px;
	}
	
	.dr-t-w {
		color: #ff557f;
		font-size: 10px;
		margin-top: -6px;
	}
	
	@keyframes mZorea {
		0%, 100% { transform: translateX(0); }
		10%, 30%, 50%, 70%, 90% { transform: translateX(-1px); }
		20%, 40%, 60%, 80% { transform: translateX(1px); }
	}
	
</style>
